|
|
Another method... if you can deal with a slight increase in parse time. Take the code
you have and copy it so it appears twice in a
row. Then take the first occurance and change it like this (I commented the "ADDED"
lines to show which ones they were):
#declare STEP=0.2;
#declare NumLights = 0; // ADDED
#declare M=-1;
#while (M<=1)
#declare N=-1;
#while (N<=1)
#declare O=-1;
#while (O<=1)
#declare NumLights = NumLights + 1; // ADDED
#declare O=O+STEP;
#end
#declare N=N+STEP;
#end
#declare M=M+STEP;
#end
Then you can divide by NumLights. Just make sure STEP is the same in both sets of
loops.
-Slime
Paul Vanukoff <van### [at] primenetcom> wrote in message
news:38761c1c@news.povray.org...
>
> I am working on a spherical light, so far it looks something like this:
>
> #declare STEP=0.2;
>
> #declare M=-1;
> #while (M<=1)
> #declare N=-1;
> #while (N<=1)
> #declare O=-1;
> #while (O<=1)
>
> #if ( (M*M+N*N+O*O) <= 1 )
> light_source
> {
> < M, N, O> color White/DIVISOR
> }
> #end
> #declare O=O+STEP;
> #end
> #declare N=N+STEP;
> #end
> #declare M=M+STEP;
> #end
>
> Only problem is, I don't know what to set DIVISOR to, in order for the
> overall brightness to equal that of a single light_source. I know it has
> something to do with the volume of a sphere, and the value of STEP. Does
> anyone know what formula to use?
>
> --
> Paul Vanukoff
> van### [at] primenetcom
>
>
>
>
Post a reply to this message
|
|